package com.wn.common.exception;

import com.wn.common.result.enums.IErrorCode;

/**
 * 自定义异常 (一般是定义 这个异常需要集成  RuntimeException)
 *        1、检查异常 和 运行异常  (解决代码 不用 写try 简化写法)
 *        2、spring事务  (默认对 RuntimeException 的异常进行管理 )
 *
 */
public class BusinessException extends RuntimeException{

    private IErrorCode errorCode;

    public IErrorCode getErrorCode() {
        return errorCode;
    }

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(IErrorCode errorCode) {
        super();
        this.errorCode = errorCode;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
